package com.zenchn.dynamic;

import static com.zenchn.dynamic.TSysCriticalOperatingLogDynamicSqlSupport.*;
import static org.mybatis.dynamic.sql.SqlBuilder.*;

import com.zenchn.model.TSysCriticalOperatingLog;
import java.util.Collection;
import java.util.List;
import java.util.Optional;
import javax.annotation.Generated;
import org.apache.ibatis.annotations.DeleteProvider;
import org.apache.ibatis.annotations.InsertProvider;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.ResultMap;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.SelectProvider;
import org.apache.ibatis.annotations.UpdateProvider;
import org.apache.ibatis.type.JdbcType;
import org.mybatis.dynamic.sql.BasicColumn;
import org.mybatis.dynamic.sql.delete.DeleteDSLCompleter;
import org.mybatis.dynamic.sql.delete.render.DeleteStatementProvider;
import org.mybatis.dynamic.sql.insert.render.InsertStatementProvider;
import org.mybatis.dynamic.sql.insert.render.MultiRowInsertStatementProvider;
import org.mybatis.dynamic.sql.select.CountDSLCompleter;
import org.mybatis.dynamic.sql.select.SelectDSLCompleter;
import org.mybatis.dynamic.sql.select.render.SelectStatementProvider;
import org.mybatis.dynamic.sql.update.UpdateDSL;
import org.mybatis.dynamic.sql.update.UpdateDSLCompleter;
import org.mybatis.dynamic.sql.update.UpdateModel;
import org.mybatis.dynamic.sql.update.render.UpdateStatementProvider;
import org.mybatis.dynamic.sql.util.SqlProviderAdapter;
import org.mybatis.dynamic.sql.util.mybatis3.MyBatis3Utils;

@Mapper
public interface TSysCriticalOperatingLogDynamicMapper {
    @Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source Table: t_sys_critical_operating_log")
    BasicColumn[] selectList = BasicColumn.columnList(logId, accessIp, accessLocation, operTime, operAccountId, operAccount, operRealName, operModule, operDetail, operAction, memo);

    @Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source Table: t_sys_critical_operating_log")
    @SelectProvider(type=SqlProviderAdapter.class, method="select")
    long count(SelectStatementProvider selectStatement);

    @Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source Table: t_sys_critical_operating_log")
    @DeleteProvider(type=SqlProviderAdapter.class, method="delete")
    int delete(DeleteStatementProvider deleteStatement);

    @Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source Table: t_sys_critical_operating_log")
    @InsertProvider(type=SqlProviderAdapter.class, method="insert")
    int insert(InsertStatementProvider<TSysCriticalOperatingLog> insertStatement);

    @Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source Table: t_sys_critical_operating_log")
    @InsertProvider(type=SqlProviderAdapter.class, method="insertMultiple")
    int insertMultiple(MultiRowInsertStatementProvider<TSysCriticalOperatingLog> multipleInsertStatement);

    @Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source Table: t_sys_critical_operating_log")
    @SelectProvider(type=SqlProviderAdapter.class, method="select")
    @ResultMap("TSysCriticalOperatingLogResult")
    Optional<TSysCriticalOperatingLog> selectOne(SelectStatementProvider selectStatement);

    @Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source Table: t_sys_critical_operating_log")
    @SelectProvider(type=SqlProviderAdapter.class, method="select")
    @Results(id="TSysCriticalOperatingLogResult", value = {
        @Result(column="log_id", property="logId", jdbcType=JdbcType.CHAR, id=true),
        @Result(column="access_ip", property="accessIp", jdbcType=JdbcType.VARCHAR),
        @Result(column="access_location", property="accessLocation", jdbcType=JdbcType.VARCHAR),
        @Result(column="oper_time", property="operTime", jdbcType=JdbcType.TIMESTAMP),
        @Result(column="oper_account_id", property="operAccountId", jdbcType=JdbcType.CHAR),
        @Result(column="oper_account", property="operAccount", jdbcType=JdbcType.VARCHAR),
        @Result(column="oper_real_name", property="operRealName", jdbcType=JdbcType.VARCHAR),
        @Result(column="oper_module", property="operModule", jdbcType=JdbcType.VARCHAR),
        @Result(column="oper_detail", property="operDetail", jdbcType=JdbcType.VARCHAR),
        @Result(column="oper_action", property="operAction", jdbcType=JdbcType.VARCHAR),
        @Result(column="memo", property="memo", jdbcType=JdbcType.VARCHAR)
    })
    List<TSysCriticalOperatingLog> selectMany(SelectStatementProvider selectStatement);

    @Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source Table: t_sys_critical_operating_log")
    @UpdateProvider(type=SqlProviderAdapter.class, method="update")
    int update(UpdateStatementProvider updateStatement);

    @Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source Table: t_sys_critical_operating_log")
    default long count(CountDSLCompleter completer) {
        return MyBatis3Utils.countFrom(this::count, TSysCriticalOperatingLog, completer);
    }

    @Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source Table: t_sys_critical_operating_log")
    default int delete(DeleteDSLCompleter completer) {
        return MyBatis3Utils.deleteFrom(this::delete, TSysCriticalOperatingLog, completer);
    }

    @Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source Table: t_sys_critical_operating_log")
    default int deleteByPrimaryKey(String logId_) {
        return delete(c -> 
            c.where(logId, isEqualTo(logId_))
        );
    }

    @Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source Table: t_sys_critical_operating_log")
    default int insert(TSysCriticalOperatingLog record) {
        return MyBatis3Utils.insert(this::insert, record, TSysCriticalOperatingLog, c ->
            c.map(logId).toProperty("logId")
            .map(accessIp).toProperty("accessIp")
            .map(accessLocation).toProperty("accessLocation")
            .map(operTime).toProperty("operTime")
            .map(operAccountId).toProperty("operAccountId")
            .map(operAccount).toProperty("operAccount")
            .map(operRealName).toProperty("operRealName")
            .map(operModule).toProperty("operModule")
            .map(operDetail).toProperty("operDetail")
            .map(operAction).toProperty("operAction")
            .map(memo).toProperty("memo")
        );
    }

    @Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source Table: t_sys_critical_operating_log")
    default int insertMultiple(Collection<TSysCriticalOperatingLog> records) {
        return MyBatis3Utils.insertMultiple(this::insertMultiple, records, TSysCriticalOperatingLog, c ->
            c.map(logId).toProperty("logId")
            .map(accessIp).toProperty("accessIp")
            .map(accessLocation).toProperty("accessLocation")
            .map(operTime).toProperty("operTime")
            .map(operAccountId).toProperty("operAccountId")
            .map(operAccount).toProperty("operAccount")
            .map(operRealName).toProperty("operRealName")
            .map(operModule).toProperty("operModule")
            .map(operDetail).toProperty("operDetail")
            .map(operAction).toProperty("operAction")
            .map(memo).toProperty("memo")
        );
    }

    @Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source Table: t_sys_critical_operating_log")
    default int insertSelective(TSysCriticalOperatingLog record) {
        return MyBatis3Utils.insert(this::insert, record, TSysCriticalOperatingLog, c ->
            c.map(logId).toPropertyWhenPresent("logId", record::getLogId)
            .map(accessIp).toPropertyWhenPresent("accessIp", record::getAccessIp)
            .map(accessLocation).toPropertyWhenPresent("accessLocation", record::getAccessLocation)
            .map(operTime).toPropertyWhenPresent("operTime", record::getOperTime)
            .map(operAccountId).toPropertyWhenPresent("operAccountId", record::getOperAccountId)
            .map(operAccount).toPropertyWhenPresent("operAccount", record::getOperAccount)
            .map(operRealName).toPropertyWhenPresent("operRealName", record::getOperRealName)
            .map(operModule).toPropertyWhenPresent("operModule", record::getOperModule)
            .map(operDetail).toPropertyWhenPresent("operDetail", record::getOperDetail)
            .map(operAction).toPropertyWhenPresent("operAction", record::getOperAction)
            .map(memo).toPropertyWhenPresent("memo", record::getMemo)
        );
    }

    @Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source Table: t_sys_critical_operating_log")
    default Optional<TSysCriticalOperatingLog> selectOne(SelectDSLCompleter completer) {
        return MyBatis3Utils.selectOne(this::selectOne, selectList, TSysCriticalOperatingLog, completer);
    }

    @Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source Table: t_sys_critical_operating_log")
    default List<TSysCriticalOperatingLog> select(SelectDSLCompleter completer) {
        return MyBatis3Utils.selectList(this::selectMany, selectList, TSysCriticalOperatingLog, completer);
    }

    @Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source Table: t_sys_critical_operating_log")
    default List<TSysCriticalOperatingLog> selectDistinct(SelectDSLCompleter completer) {
        return MyBatis3Utils.selectDistinct(this::selectMany, selectList, TSysCriticalOperatingLog, completer);
    }

    @Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source Table: t_sys_critical_operating_log")
    default Optional<TSysCriticalOperatingLog> selectByPrimaryKey(String logId_) {
        return selectOne(c ->
            c.where(logId, isEqualTo(logId_))
        );
    }

    @Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source Table: t_sys_critical_operating_log")
    default int update(UpdateDSLCompleter completer) {
        return MyBatis3Utils.update(this::update, TSysCriticalOperatingLog, completer);
    }

    @Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source Table: t_sys_critical_operating_log")
    static UpdateDSL<UpdateModel> updateAllColumns(TSysCriticalOperatingLog record, UpdateDSL<UpdateModel> dsl) {
        return dsl.set(logId).equalTo(record::getLogId)
                .set(accessIp).equalTo(record::getAccessIp)
                .set(accessLocation).equalTo(record::getAccessLocation)
                .set(operTime).equalTo(record::getOperTime)
                .set(operAccountId).equalTo(record::getOperAccountId)
                .set(operAccount).equalTo(record::getOperAccount)
                .set(operRealName).equalTo(record::getOperRealName)
                .set(operModule).equalTo(record::getOperModule)
                .set(operDetail).equalTo(record::getOperDetail)
                .set(operAction).equalTo(record::getOperAction)
                .set(memo).equalTo(record::getMemo);
    }

    @Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source Table: t_sys_critical_operating_log")
    static UpdateDSL<UpdateModel> updateSelectiveColumns(TSysCriticalOperatingLog record, UpdateDSL<UpdateModel> dsl) {
        return dsl.set(logId).equalToWhenPresent(record::getLogId)
                .set(accessIp).equalToWhenPresent(record::getAccessIp)
                .set(accessLocation).equalToWhenPresent(record::getAccessLocation)
                .set(operTime).equalToWhenPresent(record::getOperTime)
                .set(operAccountId).equalToWhenPresent(record::getOperAccountId)
                .set(operAccount).equalToWhenPresent(record::getOperAccount)
                .set(operRealName).equalToWhenPresent(record::getOperRealName)
                .set(operModule).equalToWhenPresent(record::getOperModule)
                .set(operDetail).equalToWhenPresent(record::getOperDetail)
                .set(operAction).equalToWhenPresent(record::getOperAction)
                .set(memo).equalToWhenPresent(record::getMemo);
    }

    @Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source Table: t_sys_critical_operating_log")
    default int updateByPrimaryKey(TSysCriticalOperatingLog record) {
        return update(c ->
            c.set(accessIp).equalTo(record::getAccessIp)
            .set(accessLocation).equalTo(record::getAccessLocation)
            .set(operTime).equalTo(record::getOperTime)
            .set(operAccountId).equalTo(record::getOperAccountId)
            .set(operAccount).equalTo(record::getOperAccount)
            .set(operRealName).equalTo(record::getOperRealName)
            .set(operModule).equalTo(record::getOperModule)
            .set(operDetail).equalTo(record::getOperDetail)
            .set(operAction).equalTo(record::getOperAction)
            .set(memo).equalTo(record::getMemo)
            .where(logId, isEqualTo(record::getLogId))
        );
    }

    @Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source Table: t_sys_critical_operating_log")
    default int updateByPrimaryKeySelective(TSysCriticalOperatingLog record) {
        return update(c ->
            c.set(accessIp).equalToWhenPresent(record::getAccessIp)
            .set(accessLocation).equalToWhenPresent(record::getAccessLocation)
            .set(operTime).equalToWhenPresent(record::getOperTime)
            .set(operAccountId).equalToWhenPresent(record::getOperAccountId)
            .set(operAccount).equalToWhenPresent(record::getOperAccount)
            .set(operRealName).equalToWhenPresent(record::getOperRealName)
            .set(operModule).equalToWhenPresent(record::getOperModule)
            .set(operDetail).equalToWhenPresent(record::getOperDetail)
            .set(operAction).equalToWhenPresent(record::getOperAction)
            .set(memo).equalToWhenPresent(record::getMemo)
            .where(logId, isEqualTo(record::getLogId))
        );
    }
}